//
//  ASAchiDetailCell.m
//  AttendenceSys
//
//  Created by 窦芳俊 on 16/3/29.
//  Copyright © 2016年 窦芳俊. All rights reserved.
//

#import "ASAchiDetailCell.h"


@implementation ASAchiDetailCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        CGFloat fontSize = 13;
        CGFloat padding = 17;
        CGFloat bgWidth = [[UIScreen mainScreen] bounds].size.width;
        
        // titleInfo
        _titleInfo = [[UILabel alloc] initWithFrame:CGRectZero];
        _titleInfo.frame = CGRectMake(padding, 3, bgWidth / 2, 15);
        [_titleInfo setBackgroundColor:[UIColor clearColor]];
        [_titleInfo setTextColor:RGB(51, 51, 51)];
        [_titleInfo setFont:[UIFont systemFontOfSize:fontSize]];
        [self.contentView addSubview:_titleInfo];
        
        // timeInfo
        _timeInfo = [[UILabel alloc] initWithFrame:CGRectZero];
        _timeInfo.frame = CGRectMake(_titleInfo.frame.origin.x + _titleInfo.frame.size.width + 10,
                                     3,
                                     bgWidth - 2 * padding - (_titleInfo.frame.size.width + 10),
                                     15);
        [_timeInfo setBackgroundColor:[UIColor clearColor]];
        [_timeInfo setTextColor:RGB(51, 51, 51)];
        [_timeInfo setFont:[UIFont systemFontOfSize:fontSize]];
        _timeInfo.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_timeInfo];
        
        // areaInfo
        _areaInfo = [[UILabel alloc] initWithFrame:CGRectZero];
        _areaInfo.frame = CGRectMake(padding,
                                     _titleInfo.frame.origin.y + _titleInfo.frame.size.height + 5,
                                     bgWidth - 2 * padding,
                                     15);
        [_areaInfo setBackgroundColor:[UIColor clearColor]];
        [_areaInfo setTextColor:RGB(51, 51, 51)];
        [_areaInfo setFont:[UIFont systemFontOfSize:fontSize]];
        [self.contentView addSubview:_areaInfo];
        
        // contentInfo
        _contentInfo = [[UILabel alloc] initWithFrame:CGRectZero];
        _contentInfo.frame = CGRectMake(padding,
                                        _areaInfo.frame.origin.y + _areaInfo.frame.size.height + 5,
                                        bgWidth - 2 * padding,
                                        kASAchiDetailCellHeight - (_areaInfo.frame.origin.y + _areaInfo.frame.size.height + 5) - 3);
        [_contentInfo setBackgroundColor:[UIColor clearColor]];
        [_contentInfo setTextColor:RGB(51, 51, 51)];
        [_contentInfo setFont:[UIFont systemFontOfSize:fontSize]];
        _contentInfo.numberOfLines = 4;
        [self.contentView addSubview:_contentInfo];
        
        // bottomLine
        UIImageView *bottomLine = [[UIImageView alloc] initWithFrame:CGRectMake(padding, kASAchiDetailCellHeight - 1, bgWidth - padding, 1)];
        [bottomLine setBackgroundColor:RGB(221.0, 221.0, 221.0)];
        [self.contentView addSubview:bottomLine];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

- (void)updateCellStatus:(AchievementInfo *)info
{
    _contentInfo.text = info.achiContent;
    _timeInfo.text = info.achiDate;
    
    //_contentInfo.text = @"这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容这里放入正文的值，也就是内容";
    //_titleInfo.text = @"这里放入标题的值，也就是名称";
    //_areaInfo.text = @"这里放入地址的值";
}

@end
